const app = getApp()

const _ = require('underscore')

Page({
  /**
   * 页面的初始数据
   */
  data: {
    list: []
  },

  handleInput: _.debounce((e) => {
    let pages = getCurrentPages()
    let reg = new RegExp(e.detail.value, 'gi')
    app.minipet.where({
      message: reg
    })
    .get({
      success: (res) => {
        console.log(res)
        pages[0].setData({
          list: res.data
        })
      }
    })
  }, 300)
})